package com.itheima03;

import java.util.LinkedList;

public class Linked<E> extends LinkedList<E> {
    public E updateFirst(E newTou) {
        E oldTou = super.getFirst();
        super.removeFirst();
        super.addFirst(newTou);
        return oldTou;
    }

    public E updateLast(E newWei) {
        E oldWei = super.getLast();
        super.removeLast();
        super.addLast(newWei);
        return oldWei;
    }
}
